//
//  MenuSpxzxTableViewCell.m
//  土巴兔
//
//  Created by 千锋 on 16/1/8.
//  Copyright (c) 2016年 IOS1503薛凯. All rights reserved.
//

#import "MenuSpxzxTableViewCell.h"
#import "Default.h"
#import "UIImageView+WebCache.h"
#import "MenuSpxzxModel.h"
@implementation MenuSpxzxTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createUI];
    }
    return self;
}
- (void)createUI{
    self.cellLabel=[[UILabel alloc] initWithFrame:CGRectMake(10, 10, 100, 20)];
    _cellLabel.text=@"视频学装修";
    [self.contentView addSubview:_cellLabel];
    
    _moreButton=[[UIButton alloc] initWithFrame:CGRectMake(260, 10, 50, 20)];
    [_moreButton setTitle:@"更多" forState:UIControlStateNormal];
    [_moreButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    _moreButton.alpha=0.8;
    [_moreButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -20, 0, 0)];
    [_moreButton setImage:[UIImage imageNamed:@"btn_content_arrow_right_gray"] forState:UIControlStateNormal];
    [_moreButton setImageEdgeInsets:UIEdgeInsetsMake(0, 40, 0, 0)];
    [self.contentView addSubview:_moreButton];
    
    _firstImageview=[[UIImageView alloc] initWithFrame:CGRectMake(10, 40, (DEVICEWIDTH-30)/2, 90)];
    [self.contentView addSubview:_firstImageview];
    _firstTitle=[[UILabel alloc] initWithFrame:CGRectMake(10, 130, (DEVICEWIDTH-30)/2, 20)];
    _firstTitle.font=[UIFont systemFontOfSize:16];
    [self.contentView addSubview:_firstTitle];
    _firstsjs_guest=[[UILabel alloc] initWithFrame:CGRectMake(10, 155, (DEVICEWIDTH-30)/2, 15)];
    _firstsjs_guest.font=[UIFont systemFontOfSize:14];
    [self.contentView addSubview:_firstsjs_guest];
    
    _secImageview=[[UIImageView alloc] initWithFrame:CGRectMake(165, 40, (DEVICEWIDTH-30)/2, 90)];
    [self.contentView addSubview:_secImageview];
    _secTitle=[[UILabel alloc] initWithFrame:CGRectMake(165, 130, (DEVICEWIDTH-30)/2, 20)];
     _secTitle.font=[UIFont systemFontOfSize:16];
    [self.contentView addSubview:_secTitle];
    _secsjs_guest=[[UILabel alloc] initWithFrame:CGRectMake(165, 155, (DEVICEWIDTH-30)/2, 15)];
     _secsjs_guest.font=[UIFont systemFontOfSize:14];
    [self.contentView addSubview:_secsjs_guest];
    
    _thiImageview=[[UIImageView alloc] initWithFrame:CGRectMake(10, 175, (DEVICEWIDTH-30)/2, 90)];
    [self.contentView addSubview:_thiImageview];
    _thiTitle=[[UILabel alloc] initWithFrame:CGRectMake(10, 265, (DEVICEWIDTH-30)/2, 20)];
     _thiTitle.font=[UIFont systemFontOfSize:16];
    [self.contentView addSubview:_thiTitle];
    _thisjs_guest=[[UILabel alloc] initWithFrame:CGRectMake(10, 290, (DEVICEWIDTH-30)/2, 15)];
    _thisjs_guest.font=[UIFont systemFontOfSize:14];
    [self.contentView addSubview:_thisjs_guest];
    
    _fouImageview=[[UIImageView alloc] initWithFrame:CGRectMake(165, 175, (DEVICEWIDTH-30)/2, 90)];
    [self.contentView addSubview:_fouImageview];
    _fouTitle=[[UILabel alloc] initWithFrame:CGRectMake(165, 265, (DEVICEWIDTH-30)/2, 20)];
    _fouTitle.font=[UIFont systemFontOfSize:16];
    [self.contentView addSubview:_fouTitle];
    _fousjs_guest=[[UILabel alloc] initWithFrame:CGRectMake(165, 290, (DEVICEWIDTH-30)/2, 15)];
    _fousjs_guest.font=[UIFont systemFontOfSize:14];
    [self.contentView addSubview:_fousjs_guest];
}
- (void)relyoutWithData:(NSMutableArray*)arr{
    for (int i=0; i<arr.count; i++) {
        switch (i) {
            case 0:{
                [_firstImageview sd_setImageWithURL:[NSURL URLWithString:((MenuSpxzxModel*)arr[i]).image]];
                _firstTitle.text=((MenuSpxzxModel*)arr[i]).title;
                _firstsjs_guest.text=[NSString stringWithFormat:@"本期讲师：%@",((MenuSpxzxModel*)arr[i]).sjs_guest];
                break;
            }
            case 1:{
                [_secImageview sd_setImageWithURL:[NSURL URLWithString:((MenuSpxzxModel*)arr[i]).image]];
                _secTitle.text=((MenuSpxzxModel*)arr[i]).title;
                _secsjs_guest.text=[NSString stringWithFormat:@"本期讲师：%@",((MenuSpxzxModel*)arr[i]).sjs_guest];
                break;
            }
            case 2:{
                [_thiImageview sd_setImageWithURL:[NSURL URLWithString:((MenuSpxzxModel*)arr[i]).image]];
                _thiTitle.text=((MenuSpxzxModel*)arr[i]).title;
                _thisjs_guest.text=[NSString stringWithFormat:@"本期讲师：%@",((MenuSpxzxModel*)arr[i]).sjs_guest];
                break;
            }
            case 3:{
                [_fouImageview sd_setImageWithURL:[NSURL URLWithString:((MenuSpxzxModel*)arr[i]).image]];
                _fouTitle.text=((MenuSpxzxModel*)arr[i]).title;
                _fousjs_guest.text=[NSString stringWithFormat:@"本期讲师：%@",((MenuSpxzxModel*)arr[i]).sjs_guest];
                break;
            }
            default:
                break;
        }
    }
}
@end
